<?php
$i = 0;
$brandparamid = $this->params['pass'];
if ($this->params['action'] == 'browsebybrand' AND $brandparamid[1] == 'global_brands') {
    ?>
    <script type="text/javascript">
        jQuery(function(jQuery) {
            jQuery("#accordion").accordion({
                autoHeight: false,
                header: 'h2',
                active:'#brandaccordian'
            });
        });
    </script>
    <?php
}
?>
<?php
$brandparamid = $this->params['pass'];
if ($this->params['action'] == 'browsebybrand' AND $brandparamid[1] == 'global_conditions') {
    ?>
    <script type="text/javascript">
        jQuery(function(jQuery) {
            jQuery("#accordion").accordion({
                autoHeight: false,
                header: 'h2',
                active:'#conditionaccordian'
            });
        });
    </script>
    <?php
}
?>
<?php
$brandparamid = $this->params['pass'];
if ($this->params['action'] == 'browsebybrand' AND $brandparamid[1] == 'global_styles') {
    ?>
    <script type="text/javascript">
        jQuery(function(jQuery) {
            jQuery("#accordion").accordion({
                autoHeight: false,
                header: 'h2',
                active:'#styleaccordian'
            });
        });
    </script>
    <?php
}
?>
<?php
if ($this->params['action'] == 'browsebycompletedlist') {
    ?>
    <script type="text/javascript">
        jQuery(function(jQuery) {
            jQuery("#accordion").accordion({
                autoHeight: false,
                header: 'h2',
                active:'#comaccordian'
            });
        });
    </script>
    <?php
}
?>
<?php
if ($this->params['action'] == 'browsebycategory') {
    ?>
    <script type="text/javascript">
        jQuery(function(jQuery) {
            jQuery("#accordion").accordion({
                autoHeight: false,
                header: 'h2',
                active:'#cataccordian'
            });
        });
    </script>
    <?php
}
?>
<?php
if ($this->params['action'] == 'browsebyprice') {
    ?>
    <script type="text/javascript">
        jQuery(function(jQuery) {
            jQuery("#accordion").accordion({
                autoHeight: false,
                header: 'h2',
                active:'#priceaccordian'
            });
        });
    </script>
    <?php
}
?>
<?php
if ($this->params['action'] == 'browsebysize') {
    ?>
    <script type="text/javascript">
        jQuery(function(jQuery) {
            jQuery("#accordion").accordion({
                autoHeight: false,
                header: 'h2',
                active:'#sizeaccordian'
            });
        });
    </script>
    <?php
}
?>
<?php
if ($this->params['action'] == 'browsebycolor') {
    ?>
    <script type="text/javascript">
        jQuery(function(jQuery) {
            jQuery("#accordion").accordion({
                autoHeight: false,
                header: 'h2',
                active:'#coloraccordian'
            });
        });
    </script>
    <?php
}
?>
<?php
if ($this->params['action'] == 'advance_search' OR $this->params['action'] == 'browsebycategory' OR $this->params['action'] == 'browsebybrand' OR $this->params['action'] == 'browsebycompletedlist' OR $this->params['action'] == 'browsebyprice' OR $this->params['action'] == 'browsebysize' OR $this->params['action'] == 'browsebycolor' OR $this->params['action'] == 'search_result') {
    ?>
    <div id="accordion" class="accordion-lft" style="width:172px;">
        <?php
        //$leftmenubrand = $this->requestAction('/products/brand_menu/global_brands');
        if (!empty($leftmenubrand)) {
            ?>
            <div class="section">
                <h2 id="brandaccordian">Brand</h2>
                
                        <div class="section-content">
                        <?php
                        foreach ($leftmenubrand as $leftmenub) {
                            if (!empty($leftmenub['Brand']['id'])) {
                                if ($browseByBrandViewCookie == "thumb") {
                                    ?>
                                    <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebybrand/<?php echo $leftmenub['Brand']['id']; ?>/global_brands/thumb?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>"><?php
                                        echo $leftmenub['Brand']['brand_description'];
                                        if (isset($search) && $search == 1)
                                            echo ' (' . $leftmenub[0]['totalproduct'] . ')';
                                        else
                                            echo ' (' . $leftmenub[0]['totalproduct'] . ')';
                                                        ?>
                                     </a></p>
                                <?php } else { ?>
                                    <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebybrand/<?php echo $leftmenub['Brand']['id']; ?>/global_brands?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>">
                                    <?php
                                    echo $leftmenub['Brand']['brand_description'];
                                    if (isset($search) && $search == 1)
                                        echo ' (' . $leftmenub[0]['totalproduct'] . ')';
                                    else
                                        echo ' (' . $leftmenub[0]['totalproduct'] . ')';
                                                    ?>
                                     </a></p>
                                    <?php
                                }
                            }
                        }
                        if (isset($search) && $search != 1) {
                            ?>
                            <p><a href="<?php echo Configure::read('base_url'); ?>brands">See more</a></p>
                        <?php } ?>
                    </div>
                </div>
                <?php
            }
            ?>
            <div class="section">
                <h2 id="cataccordian">Categories index</h2>            
                <div class="section-content">            
                    <?php                    
                    foreach ($item as $items) {
                        if ($browseByCategoryViewCookie == "thumb") {
                            ?>       
                            <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebycategory/<?php echo $items['Category']['id']; ?>/thumb?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>" class="lnk" >
                                    <?php
                                    echo $items['Category']['category_name'];
                                    if ((isset($search) && $search == 1) OR ($searchkey!=""))
                                        echo"(" . $items[0]['total'] . ")";
                                    ?></a></p>        
                                <?php } else { ?>
                            <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebycategory/<?php echo $items['Category']['id']; ?>?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>" class="lnk" >
                                    <?php echo $items['Category']['category_name'];
                                    if ((isset($search) && $search == 1) OR ($searchkey!=""))
                                        echo"(" . $items[0]['total'] . ")"; ?></a></p>
                            <?php
                        }
                    }if (isset($search) && $search != 1) {
                        ?>
                        <p><a href="<?php echo Configure::read('base_url'); ?>category/viewall">View all</a></p>
    <?php } ?>
                </div>
            </div>
            <div class="section">
                <h2 id="priceaccordian">Price</h2>
                <div class="section-content" style="padding: 0 2px;">
                    <p><form method="POST" action="<?php echo Configure::read('base_url'); ?>products/browsebyprice/?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>" id="priceform">
                        $<input type="text" style="width:30px;" name="price1" <?php if (isset($price1)) { ?>value="<?php echo $price1; ?>"<?php } else { ?>value="" <?php } ?> title=" " class="required"/>
                        to $<input type="text" style="width:30px;" name="price2" title=" "  <?php if (isset($price2)) { ?>value="<?php echo $price2; ?>"<?php } else { ?>value="" <?php } ?> class="required"/>
                        <input type="submit" value="Go" name="go">
                    </form>
                    </p>
                </div>
            </div>
            <?php
            if (!empty($leftmenucondition)) {
                ?>
                <div class="section">
                    <h2 id="conditionaccordian">Condition</h2>
                    <div class="section-content">
                        <?php
                        foreach ($leftmenucondition as $leftmenuc) {
                            if (!empty($leftmenuc['ProductCondition']['id'])) {
                                if ($browseByConditionViewCookie == "thumb") {
                                    ?>
                                    <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebybrand/<?php echo $leftmenuc['ProductCondition']['id']; ?>/global_conditions/thumb?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>"><?php
                        echo $leftmenuc['ProductCondition']['brand_description'];
                        if (isset($search) && $search == 1)
                            echo ' (' . $leftmenuc[0]['totalproduct'] . ')';
                        else
                            echo ' (' . $leftmenuc[0]['totalproduct'] . ')';
                        ?></a></p>
                                        <?php } else { ?>
                                    <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebybrand/<?php echo $leftmenuc['ProductCondition']['id']; ?>/global_conditions?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>"><?php
                        echo $leftmenuc['ProductCondition']['brand_description'];
                        if (isset($search) && $search == 1)
                            echo ' (' . $leftmenuc[0]['totalproduct'] . ')';
                        else
                            echo ' (' . $leftmenuc[0]['totalproduct'] . ')';
                                            ?></a></p>
                                    <?php
                                }
                            }
                        }
                        ?>
                    </div>
                </div>
                <?php
            }
            ?>
    <?php
    //$leftmenusize = $this->requestAction('/products/size_menu');
    if (!empty($leftmenusize)) {
        ?>
                <div class="section">
                    <h2 id="sizeaccordian">Size</h2>
                    <div class="section-content" id="sizeContent">
                        <?php
                        foreach ($leftmenusize as $leftmenusz) {
                            if ($browseBySizeViewCookie == "thumb") {
                                ?>            
                                <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebysize/<?php echo $leftmenusz['Sizevalue']['size_value']; ?>/thumb?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>"><?php echo $leftmenusz['Sizevalue']['size_value']; ?></a></p>
                            <?php } else { ?>
                                <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebysize/<?php echo $leftmenusz['Sizevalue']['size_value']; ?>?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>"><?php echo $leftmenusz['Sizevalue']['size_value']; ?></a></p>
                <?php
            }
        }
        ?>
                    </div>
                </div>
        <?php
    }
    if (!empty($leftmenucolor)) {
        ?>
                <div class="section">
                    <h2 id="coloraccordian">Color</h2>
                    <div class="section-content">
                        <?php
                        foreach ($leftmenucolor as $leftmenucl) {
                            if ($browseByColorViewCookie == "thumb") {
                                ?>
                                <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebycolor/<?php echo $leftmenucl['ProductAdditionalFieldValue']['values']; ?>/thumb?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>"><?php echo $leftmenucl['ProductAdditionalFieldValue']['values']; ?></a></p>
                            <?php } else { ?>
                                <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebycolor/<?php echo $leftmenucl['ProductAdditionalFieldValue']['values']; ?>?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>"><?php echo $leftmenucl['ProductAdditionalFieldValue']['values']; ?></a></p>
                <?php
            }
        }
        ?>
                    </div>
                </div>
        <?php
    }
    if (!empty($leftmenustyle)) {
        ?>
                <div class="section">
                    <h2 id="styleaccordian">Style</h2>
                    <div class="section-content" id="styleContent">
                        <?php
                        foreach ($leftmenustyle as $leftmenus) {
                            if (!empty($leftmenus['ProductStyle']['id'])) {
                                if ($browseByStyleViewCookie == "thumb") {
                                    ?>
                                    <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebybrand/<?php echo $leftmenus['ProductStyle']['id']; ?>/global_styles/thumb?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>"><?php
                        echo $leftmenus['ProductStyle']['brand_description'];
                        if (isset($search) && $search == 1)
                            echo ' (' . $leftmenus[0]['totalproduct'] . ')';
                        else
                            echo ' (' . $leftmenus[0]['totalproduct'] . ')';
                                    ?></a></p>
                                        <?php } else { ?>
                                    <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebybrand/<?php echo $leftmenus['ProductStyle']['id']; ?>/global_styles?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>"><?php
                        echo $leftmenus['ProductStyle']['brand_description'];
                        if (isset($search) && $search == 1)
                            echo ' (' . $leftmenus[0]['totalproduct'] . ')';
                        else
                            echo ' (' . $leftmenus[0]['totalproduct'] . ')';
                                            ?></a></p>
                                    <?php
                                }
                            }
                        }
                        ?>
                    </div>
                </div>
        <?php
    }
    ?>
            <div class="section">
                <h2 id="comaccordian">Completed Listings</h2>
                <div class="section-content">
                    <?php if ($browseBySoldViewCookie == "thumb") { ?>
                        <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebycompletedlist/sold?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>">Sold items</a></p>
                    <?php } else { ?>
                        <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebycompletedlist/sold?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>">Sold items</a></p>
                    <?php } if ($browseByUnsoldViewCookie == "thumb") { ?>   
                        <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebycompletedlist/unsold?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>">Unsold items</a></p>
                    <?php } else { ?>
                        <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebycompletedlist/unsold?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>">Unsold items</a></p>
                    <?php } if ($browseByAllViewCookie == "thumb") { ?>   
                        <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebycompletedlist/all?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>">All Items</a></p>
                    <?php } else { ?>
                        <p><a href="<?php echo Configure::read('base_url'); ?>products/browsebycompletedlist/all?keywords=<?php echo $searchkey;?>&query=<?php echo $query;?>">All Items</a></p>
                    <?php } ?>
                </div>
            </div>
        </div>
<?php } else { ?>
        <div class="leftnav">Category Index</div>
        <!-- Start PureCSSMenu.com STYLE -->
        <style type="text/css">
            #pcm{display:none;}
            ul.pureCssMenu ul{display:none;width: 171px;}
            ul.pureCssMenu li:hover>ul{display:block;cursor: pointer;}
            ul.pureCssMenu ul{position: absolute;left:100%;top:0;}
            ul.pureCssMenu ul ul{position: absolute;left:101%;top:0;}
            ul.pureCssMenu,ul.pureCssMenu ul {margin:0px;
                                              list-style:none;padding:0px 1px 0px 0px;background-color:#E3E3E3;background-repeat:repeat;border-width:0px;
                                              border-style:solid;font-weight: bold;z-index: 100;cursor: pointer;
            }
            ul.pureCssMenu table {border-collapse:collapse}
            ul.pureCssMenu {display:block;zoom:1;_width:136.5px;float: left;width: 171px;}
            ul.pureCssMenu ul{width:165px;font-weight: bold;background-color: #FFFFFF;border-top: 1px solid #999;border-right: 1px solid #eee;border-bottom: 1px solid #999;}
            ul.pureCssMenu li{display:block;margin:1px 0px 0px 1px;	font-weight: bold;}
            ul.pureCssMenu a:active, ul.pureCssMenu a:focus {
                outline-style:none;
            }
            ul.pureCssMenu a, ul.pureCssMenu li.dis a:hover, ul.pureCssMenu li.sep a:hover {
                display:block;vertical-align:middle;zoom:1;background-color:#FFFFFF;border-width:0px;
                border-color:#E4E1DE;border-style:solid;text-align:left;text-decoration:underline;padding:4px;
                _padding-left:0;font-family: trebuchet MS,Arial,Helvetica,sans-serif;color: #082341;text-decoration:none;
                cursor:default;font-weight: bold;
            }
            ul.pureCssMenu span{overflow:hidden;}
            ul.pureCssMenu ul li {float:none;}
            ul.pureCssMenu ul a {text-align:left;white-space:nowrap;}
            ul.pureCssMenu li.sep{text-align:left;padding:0px;line-height:0;}
            ul.pureCssMenu li.sep span{float:none;padding-right:0;width:100%;height:3px;display:inline-block;background-color: background-image:none;}
            ul.pureCssMenu li:hover{position:relative;cursor: pointer;}
            ul.pureCssMenu li:hover>a{background-color:#DDE5F4;font-family: trebuchet MS,Arial,Helvetica,sans-serif;
                                      color: #082341;font-weight: bold;text-decoration:none;}
            ul.pureCssMenu li a:hover{position:relative;
                                      background-color:#DDE5F4;font-family: trebuchet MS,Arial,Helvetica,sans-serif;
                                      color: #082341;text-decoration:none;font-weight: bold;cursor: pointer;}
            ul.pureCssMenu li.dis a {color: #AAAAAA !important;}
            ul.pureCssMenu img {border: none;float:left;_float:none;margin-right:4px;width:24px;height:24px;}
            ul.pureCssMenu ul img {width:16px;height:16px;}
            ul.pureCssMenu li ul li{border-left: 1px solid #999; margin: 0 !important;}
            ul.pureCssMenu li ul li a{ border:none !important;}
            ul.pureCssMenu img.over{display:none}
            ul.pureCssMenu li.dis a:hover img.over{display:none !important}
            ul.pureCssMenu li.dis a:hover img.def {display:inline !important}
            ul.pureCssMenu li:hover > a img.def  {display:none}
            ul.pureCssMenu li:hover > a img.over {display:inline}
            ul.pureCssMenu a:hover img.over,ul.pureCssMenu a:hover ul img.def,ul.pureCssMenu a:hover a:hover ul img.def,ul.pureCssMenu a:hover a:hover a:hover ul img.def,ul.pureCssMenu a:hover a:hover img.over,ul.pureCssMenu a:hover a:hover a:hover img.over,ul.pureCssMenu a:hover a:hover a:hover a:hover img.over{display:inline}
            ul.pureCssMenu a:hover img.def,ul.pureCssMenu a:hover ul img.over,ul.pureCssMenu a:hover a:hover ul img.over,ul.pureCssMenu a:hover a:hover a:hover ul img.over,ul.pureCssMenu a:hover a:hover img.def,ul.pureCssMenu a:hover a:hover a:hover img.def,ul.pureCssMenu a:hover a:hover a:hover a:hover img.def{display:none}
            ul.pureCssMenu a:hover ul,ul.pureCssMenu a:hover a:hover ul,ul.pureCssMenu a:hover a:hover a:hover ul{display:block}
            ul.pureCssMenu a:hover ul ul,ul.pureCssMenu a:hover a:hover ul ul{display:none}
            ul.pureCssMenu span{
                display:block;
                background-image:url(<?php echo $this->webroot; ?>img/arrow_menuL6_2.gif);
                /*	background-image:url(<?php echo $this->webroot; ?>img/elements.gif") no-repeat scroll 149px -309px transparent);*/
                background-position:right center;
                background-repeat: no-repeat;
                padding-right:12px;}
            ul.pureCssMenu li:hover>a>span{	background-image:url(<?php echo $this->webroot; ?>img/arrow_menuL6_2.gif);
                                            text-decoration: underline;
                                            font-weight: bold;
            }
            ul.pureCssMenu a:hover span{	_background-image:url(<?php echo $this->webroot; ?>img/arrow_menuL6_2.gif)}
            ul.pureCssMenu ul span,ul.pureCssMenu a:hover table span{background-image:url(<?php echo $this->webroot; ?>img/arrow_menuL6_2.gif)}
            ul.pureCssMenu ul li:hover > a span{	background-image:url(<?php echo $this->webroot; ?>img/arrow_menuL6_2.gif);}
            ul.pureCssMenu table a:hover span,ul.pureCssMenu table a:hover a:hover span,ul.pureCssMenu table a:hover a:hover a:hover span{background-image:url(<?php echo $this->webroot; ?>img/arrow_menuL6_2.gif);}
            ul.pureCssMenu table a:hover table span,ul.pureCssMenu table a:hover a:hover table span{background-image:url(<?php echo $this->webroot; ?>img/arrow_menuL6_2.gif)}
        </style>
        <!-- End PureCSSMenu.com STYLE -->
        <!-- Start PureCSSMenu.com MENU -->
        <div class="catnav">
            <div id="v4-0" class="csm" >
                <ul class="pureCssMenu pureCssMenum">
                            <?php foreach ($item as $items): ?>
                        <li class="pureCssMenui">
                                    <?php if ($browseByCategoryViewCookie == "thumb") { ?>
                                <a class="pureCssMenui" href="<?php echo Configure::read('base_url'); ?>products/browsebycategory/<?php echo $items['Category']['id']; ?>/thumb">
                                <?php } else { ?>
                                    <a class="pureCssMenui" href="<?php echo Configure::read('base_url'); ?>products/browsebycategory/<?php echo $items['Category']['id']; ?>">
                                    <?php } ?>
                  <span><?php echo $items['Category']['category_name']; ?></span><![if gt IE 6]></a><![endif]><!--[if lte IE 6]><table><tr><td><![endif]-->
                                    <?php if (!empty($items['child'])) { ?>
                                    <ul class="pureCssMenum">
                                            <?php
                                            $i = 0;
                                            foreach ($items['child'] as $child):
                                                ?>
                                            <li class="pureCssMenui" <?php if ($i == 0) { ?>style="border-left: none;" <?php } ?>>
                                                        <?php if ($browseByCategoryViewCookie == "thumb") { ?>
                                                    <a class="pureCssMenui" href="<?php echo Configure::read('base_url'); ?>products/browsebycategory/<?php echo $child['Category']['id']; ?>/thumb">
                                                    <?php } else { ?>
                                                        <a class="pureCssMenui" href="<?php echo Configure::read('base_url'); ?>products/browsebycategory/<?php echo $child['Category']['id']; ?>">               
                                                        <?php } ?>
                                                        <?php if (!empty($child['child1'])) { ?> <span><?php } echo $child['Category']['category_name']; ?><?php if (!empty($child['child1'])) { ?></span><?php } ?><![if gt IE 6]></a><![endif]><!--[if lte IE 6]><table><tr><td><![endif]-->
                                                        <?php if (!empty($child['child1'])) { ?>
                                                        <ul class="pureCssMenum">
                                                                <?php
                                                                $j = 0;
                                                                foreach ($child['child1'] as $child1):
                                                                    ?>
                                                                <li class="pureCssMenui" <?php if ($j == 0) { ?>style="border-left: none;" <?php } ?>>
                                                                            <?php if ($browseByCategoryViewCookie == "thumb") { ?>
                                                                        <a class="pureCssMenui" href="<?php echo Configure::read('base_url'); ?>products/browsebycategory/<?php echo $child1['Category']['id']; ?>/thumb">
                                                                <?php } else { ?>
                                                                            <a class="pureCssMenui" href="<?php echo Configure::read('base_url'); ?>products/browsebycategory/<?php echo $child1['Category']['id']; ?>">
                                                                <?php } ?>
                                                                <?php echo $child1['Category']['category_name']; ?>
                                                                        </a></li>
                                                            <?php
                                                            $j++;
                                                        endforeach;
                                                        ?>
                                                        </ul>
                                            <?php } ?>
                                                    <!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
                                        <?php
                                        $i++;
                                    endforeach;
                                    ?>
                                    </ul>
        <?php } ?>
                                <!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
        <?php endforeach; ?>
                    <li class="pureCssMenui"><?php echo $this->Html->link('VIEW ALL', array('controller' => 'category', 'action' => 'viewall'), array('style' => "text-align:right;")); ?></li>
                </ul>
            </div>
        </div>
        <?php
    }
    ?>
    <a href="<?php echo Configure::read('base_url'); ?>brands" class="brandindex">Brand Index</a>
    <?php if ($session->read('Auth.User.id') == null) { ?>
        <a href="javascript:void(0);" controller="users" action="popup_login" title="login"  onclick='showPop(this)' class="viewcart"></a>
<?php } else { ?>
        <a href="<?php echo Configure::read('base_url'); ?>carts/view_cart" class="viewcart"></a>
    <?php
}?>